<?php
    $base_dir = "filelist/";
    $fso = opendir($base_dir);
    echo $base_dir."<hr/>";
    while($flist=readdir($fso)){
        echo $flist."<br/>";
    }
    closedir($fso);


    $d = dir("/etc/php5");
    echo "Handle:".$d->handle . "\n";
    echo "Path: " . $d->path . "\n";
    while (false !== ($entry = $d->read())) {
        echo $entry."\n";
    }
    $d->close();


    $counter_file = 'aa.txt';
    $fopen = fopen($counter_file,'wb');
    fputs($fopen,'aaaaaa');
    fclose($fopen);


    $file = 'dirlist.php';
    if (is_readable($file) == false) {
        die('文件不存在或者无法读取');
    } else {
        echo '存在';
    }


    $file = 'dirlist.php';
    if (is_writable($file) == false) {
        die('我想放假，我想旅游');
    }
    $data = '但我贪心,我都想要';
    file_put_contents ($file, $data);


    $file = 'dirlist.php';
    $result = @unlink ($file);
    if ($result == false) {
        echo '蚊子赶走了';
    } else {
        echo '无法赶走';
    }
?>